import { PostSummary } from "@/shared/types";
import { VenetianMask } from "lucide-react";
import Link from "next/link";

export default function PostSummaryList({ posts }: { posts: PostSummary[] }) {
  if (posts.length === 0) {
    return <div>没有文章</div>; // TODO: 样式
  }

  return (
    <ul className="border-y border-zinc-200">
      {posts.map((post) => (
        <li
          key={post.id}
          className="border-t first:border-0 p-3 border-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-800 text-lg"
        >
          <Link href={`/posts/${post.id}`}>
            {post.title}

            {post.createTime.toISOString()}
            {post.personal && <VenetianMask />}
          </Link>
        </li>
      ))}
    </ul>
  );
}
